<!DOCTYPE html>
<html>
<head>
    <title>Phase Separation of He-3 and He-4</title>
    <style>
        body {
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            margin: 0;
            background-color: #f0f0f0;
        }
        canvas {
            border: 1px solid #ccc;
            background-color: #fff;
        }
    </style>
</head>
<body>
<canvas id="physicsDiagram" width="700" height="400"></canvas>
<script>
    const canvas = document.getElementById('physicsDiagram');
    const ctx = canvas.getContext('2d');

    // --- Style setup ---
    // A font that approximates a handwritten technical style.
    const FONT_STYLE = '22px "Comic Sans MS", cursive, sans-serif';
    const BOLD_FONT_STYLE = 'bold 22px "Comic Sans MS", cursive, sans-serif';
    ctx.fillStyle = 'black';
    ctx.strokeStyle = 'black';
    
    // --- Main Drawing Function ---
    function drawDiagram() {
        // --- Container ---
        const containerX = 75;
        const containerY = 100;
        const containerWidth = 350;
        const containerHeight = 120;
        const boundaryY = containerY + containerHeight / 2;
        
        ctx.lineWidth = 2;
        ctx.beginPath();
        ctx.rect(containerX, containerY, containerWidth, containerHeight);
        ctx.moveTo(containerX, boundaryY);
        ctx.lineTo(containerX + containerWidth, boundaryY);
        ctx.stroke();

        // --- Dilute Phase (Stippling) ---
        const numDots = 200;
        for (let i = 0; i < numDots; i++) {
            const dotX = containerX + 5 + Math.random() * (containerWidth - 10);
            const dotY = boundaryY + 5 + Math.random() * (containerHeight / 2 - 10);
            // Randomize dot size for a more hand-drawn feel
            const radius = 0.5 + Math.random() * 1.5;
            ctx.beginPath();
            ctx.arc(dotX, dotY, radius, 0, 2 * Math.PI);
            ctx.fill();
        }

        // --- Labels ---
        ctx.font = FONT_STYLE;
        ctx.textAlign = 'left';
        ctx.textBaseline = 'middle';
        ctx.lineWidth = 1;

        const labelStartX = containerX + containerWidth + 30;

        // Concentrated phase label
        const concPointerY = containerY + containerHeight * 0.25;
        ctx.beginPath();
        ctx.moveTo(labelStartX, concPointerY);
        ctx.lineTo(containerX + containerWidth, concPointerY);
        ctx.stroke();
        ctx.fillText('concentrated phase of \u00B3He', labelStartX + 10, concPointerY);

        // Dilute phase label
        const dilutePointerY = containerY + containerHeight * 0.75;
        const diluteTextY1 = dilutePointerY - 14;
        const diluteTextY2 = dilutePointerY + 14;
        
        ctx.beginPath();
        ctx.moveTo(labelStartX, dilutePointerY);
        ctx.lineTo(containerX + containerWidth, dilutePointerY);
        ctx.stroke();
        
        ctx.fillText('dilute phase of \u00B3He', labelStartX + 10, diluteTextY1);
        ctx.fillText('(in superfluid of \u2074He)', labelStartX + 10, diluteTextY2);


        // --- Figure Caption ---
        ctx.font = BOLD_FONT_STYLE;
        ctx.textAlign = 'center';
        const captionY = containerY + containerHeight + 40;
        ctx.fillText('Fig. 2.23.', containerX + containerWidth / 2, captionY);
    }

    drawDiagram();
</script>
</body>
</html>